Method and apparatus to measure self-capacitance using a single pin

ABSTRACT

A method may include controlling a first switch to charge a reference capacitor to a first voltage level by applying a first voltage. The method may also include receiving a first analog signal from a touch sensor electrode at an input of an Analog to Digital Converter (ADC) and converting the first analog signal to a first digital value provided at an output of the ADC. In certain embodiments, the method may additionally include controlling a second switch to charge the reference capacitor to a second voltage level by applying a second voltage, receiving a second analog signal from the touch sensor electrode at the input to the ADC, and converting the second analog signal to a second digital value at the output of the ADC. The method may further include detecting a touch to the touch sensor device based on the first digital value.

RELATED APPLICATION

This continuation application claims the benefit under 35 U.S.C. § 120of the priority of U.S. patent application Ser. No. 12/567,473, filedSep. 25, 2009, entitled “Method and Apparatus to MeasureSelf-Capacitance Using a Single Pin.”

BACKGROUND

Touch sensors, such as touch buttons and sliders, are used to enhance avariety of functions and turn everyday devices into exciting newproducts. Touch sensors may be implemented using a variety oftechnologies, where a touch to the surface changes electricalrelationships within the touch sensors. Quality testing of a touchsensors device or capacitive keyboard involves anticipating theoperating conditions of the touch sensors to confirm consistent andacceptable performance.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating electrical parameters of acapacitive device, according to an example embodiment.

FIG. 2 is a block diagram illustrating a touch sensor system, accordingto an example embodiment.

FIG. 3 is a block diagram illustrating a test configuration for thecapacitive device as in FIG. 1, according to an example embodiment.

FIG. 4 is a table illustrating the operations in testing the capacitivedevice using the test configuration of FIG. 3, according to an exampleembodiment.

FIG. 5 is a block diagram illustrating a test structure for a touchsensor device, according to an example embodiment.

FIG. 6 is a block diagram illustrating a test configuration to measureself-capacitance using a single pin of a touch sensor device, accordingto an example embodiment.

FIG. 7 is a table illustrating operations in testing theself-capacitance of the touch sensor device of FIG. 5, according to anexample embodiment.

FIG. 8 is a block diagram of the touch sensor device of FIG. 5,according to an example embodiment.

FIG. 9 is a flow diagram of a method for testing self-capacitance of thetouch sensor, according to an example embodiment.

DETAILED DESCRIPTION

In the following description, reference is made to the accompanyingdrawings that form a part hereof, and in which is shown by way ofillustration specific embodiments which may be practiced. Theseembodiments are described in sufficient detail to enable those skilledin the art to practice the invention, and it is to be understood thatother embodiments may be utilized and that structural, logical andelectrical changes may be made without departing from the scope of thepresent invention. The following description of example embodiments is,therefore, not to be taken in a limited sense, and the scope of thepresent invention is defined by the appended claims.

The functions or algorithms described herein may be implemented insoftware or a combination of software and human implemented proceduresin one embodiment. The software may consist of computer executableinstructions stored on computer readable media such as memory or othertype of storage devices. Further, such functions correspond to modules,which are software, hardware, firmware or any combination thereof.Multiple functions may be performed in one or more modules as desired,and the embodiments described are merely examples. The software may beexecuted on a Digital Signal Processor (DSP), Application SpecificIntegrated Circuit (ASIC), microprocessor, microcontroller, virtualcontroller system, or other type of processor operating on a computersystem, such as a personal computer, server or other computer system.

Touchscreen displays and user interfaces may be implemented in variousconfigurations, and may include one or more conductive layers. Thefollowing discussion relates to methods for testing a device having aninternal capacitance, such as a mutual capacitance sensor device, havinga driving layer and a sensing layer. These testing methods use theelectrical characteristics and behavior of a capacitive sensor toprovide a simplified test configuration and procedure. By takingadvantage of the internal structure of a touch sensor device, these testmethods may reduce reliance on external testing components used inprevious test configurations.

While the testing methods and apparatuses disclosed herein are describedwith respect to a capacitive touch sensor, the test methods andapparatuses are applicable to other configurations, including singlelayer and multiple layer configurations of capacitive traces in asensing device. The techniques may also be used to test capacitivekeyboards or other devices using capacitive sensors.

In an example embodiment, a touch sensor system includes at least oneinput port to receive an input signal from at least one electrode, theat least one electrode having a coupling capacitance. The touch sensorsystem further includes an Analog to Digital Converter (ADC) to convertreceived continuous analog signals to discrete digital values, which maybe used for processing and further computation. The ADC output value isproportional to the magnitude of the input voltage (or current). The ADCmay be implemented in a variety of ways as an electronic device, such asa direct conversion or flash circuit, a successive approximationconverter, a ramp-compare converter, an integrating converter, aSigma-Delta converter, and so forth. The digital output may be processedto apply a coding scheme to identify the corresponding analog inputvalue. A touch sensor system may include a processing unit to performoperations in response to computer-readable instructions. The operationsmay incorporate the ADC output data. A capacitor, such as a filteringcapacitor, may be coupled to the ADC input. The capacitor may be used asa reference capacitor for detecting a touch on the touch sensorelectrodes. A set of switches is provided as a mechanism to couplecharge to the reference capacitor. A first switch couples a firstreference voltage to a first input of multiple multiplexor (MUX) inputs,and a second switch couples a second reference voltage to the firstinput of the MUX, the MUX having an output coupled to an ADC input,wherein a MUX controller selects at least one of the MUX inputs toprovide as an input to the ADC. A switch controller controls the firstswitch to apply the first reference voltage to the first input of theMUX, and controls the second switch to apply the second referencevoltage to the first input of the MUX. Further, a sensor controller iscoupled to receive a first digital value from the ADC output afterapplication of the first reference voltage, to receive a second digitalvalue after application of the second reference voltage, and todetermine a change in the coupling capacitance of the at least oneelectrode as a function of the first and second digital values.

FIG. 1 illustrates an equivalent circuit representing a capacitivesensor system 100 having a capacitive sensor device 110, The sensorsystem 100 has an electrode 112. The electrode 112 may be responsive toa touch by a human hand or a device, such as a stylus. The human hand ordevice has a touch capacitance C_(t) measured with respect to earth orground. The electrode 112 is coupled to sensor circuitry 114 within thesensor device 110. As the electrode 112 is provided behind or below adielectric panel (not shown), the user does not have direct galvanicconnection to the touch sensor circuitry 114.

Internal to sensor device 110, the sensor circuitry 114 may be coupledto sensor firmware 116 controlling the sensor device 110 andinterpreting the received touches at the electrode 112. The structureand configuration of the sensor device 110 has various selfcapacitances, such as capacitance C_(p1) which is measured at a point,P1, on a conductor between the electrode 112 and the sensor circuitry114. The capacitance C_(p1) is the parasitic Input/Output (I/O) pincapacitance considered with respect to a reference ground. The electrode112 has an electrode capacitance C_(x) with respect to a relative earthvoltage, referred to as earth, A capacitance C_(p2) is the wiringcapacitance measured at a point P2, and is considered with respect tothe reference ground. In the capacitive sensor system 100, referenceground is considered the voltage between a given point and a localcircuit return point, wherein the reference ground voltage may be anyvoltage value to which the voltages of other points are compared. Thereference ground voltage may be a specific voltage level applied to thesensor device 110, or may be a reference plane within the sensor device110. In contrast, earth is considered a free space return point, such asthe potential difference measured from a user's finger to the earth orenvironment. A touch capacitance C exists between a human finger, orstylus, and earth. Between the relative ground and earth is a couplingcapacitance C_(f). These various capacitances exist in the configurationand structure of the capacitive sensor system 100.

In some examples, a test method includes the following assumptions:C _(x) >>C _(p2)  (1)C _(x) >>C _(p1)  (2)C _(f) >>C _(x)  (3)C _(f) >>C _(t)  (4)in evaluation of the capacitive sensor system 100.

FIG. 2 illustrates a touch sensor configuration 200 including thecapacitive sensor device 110 coupled to a touch sensor interface 206.The touch sensor interface 206 may include one or more electrodes,similar to the electrode 112 of FIG. 1. A panel 202, such as adielectric panel overlays the touch sensor interface 206. A displaymodule 204 is positioned below the touch sensor interface 206, and isvisible through the panel 202 and the touch sensor interface 206. Thecapacitive sensor device 110 receives inputs from the touch sensorinterface, wherein the inputs may correspond to instructions, selectionsor other information provided by a user.

Some embodiments of touch sensor configurations include differentcombinations of layers, as well as different implementations of thesensing device. In the example illustrated in FIG. 2, the touch sensorinterface 206 is implemented as a capacitive sensor as used in a varietyof touch sensor devices.

FIG. 3 illustrates a test configuration 300 for a sensor device 310coupled to an electrode 312. As in the capacitive sensor system 100 ofFIG. 1, the electrode 312 is position behind or below a dielectricpanel, and thus does not make a galvanic connection with a user orstylus when a touch is made to the capacitive sensor system. The testconfiguration includes a sampling capacitor C_(s) that is positionedbetween two output ports, 318 and 320, of the sensor device 310.Internally, the sensor device 310 has multiple switches, such as switchS1 which is used to connect port 318 to an electrical ground, switch S2which is used to connect port 320 to a reference voltage V_(DD), and aswitch S3 which is used to connect port 320 to a reference ground.

With reference to the test configuration 300 of FIG. 3, a table 400 isprovided in FIG. 4 illustrating operations for testing the sensor device310. The left-most column provides the step index, wherein steps areperformed sequentially as indicated. The next column identifies thebehavior or condition of switch S1, successive columns identify thebehavior of condition of switches S2 and S3, respectively. Notes areprovided to explain the test procedure. The test procedure measures thecapacitance C_(x) using the sampling capacitance C_(s). This may be doneby monitoring the behavior of the capacitance C_(x), in response tosequence of bursts or charge transfers. The bursts are provided usingthe switches. In this way, a burst switching sequence is applied todetermine the capacitance C_(x). A burst is a sequence of chargetransfers. By controlling switches S1, S2 and S3, the process transferscharge to capacitor C_(x) through C_(s) by repeating the bursts tomeasure or calculate C_(x).

At step 1 of table 400 the switch S2 is open, while the switches S1 andS3 are closed. Connecting both sides of the sampling capacitor torelative ground effectively discharges any residual charge stored on thesampling capacitor, C_(s), as well as on the electrode's capacitance,C_(x). This is an initial condition of a measurement process, referredto as an acquisition phase.

At step 2 of table 400 the switches S1, S2 and S3 are open allowing thecapacitors to float, and specifically allowing the sampling capacitorC_(s) to float. This prevents cross-conduction within transistors of thesensor device 310.

At step 3, switch S2 is closed, while the switches S1 and S3 remainopen. Charge is driven through sampling capacitor C_(s) to the capacitorC_(x). In this switching state, the same current flows through C_(s) andC_(x) so the charge transferred to each capacitor is effectively thesame. Then at step 4, the switches S1, S2 and S3 are open allowing thesampling capacitor C_(s) to float. As in step 2, allowing the capacitorsto float prevents cross-conduction between transistors in the sensordevice 310. There is a settling time to allow the charge distribution tosettle.

At step 5, the switch S1 is closed, while switches S2 and S3 remainopen, which discharges the capacitor C_(x). This completes a burst, andprocessing returns, 420, to step 2 for a next burst. Burst switchingallows transfer of charge to the capacitance C_(x) through thecapacitance Cs. The time to charge C_(x), or the number of burst cyclesused, is related to a ratio of capacitance for C_(x) to C_(s). As Cx andCs form a potential divider circuit defined by:V(C _(s))=(C _(x) *V _(dd))/(C _(s) +C _(x))  (5)wherein V(C_(s)) is the voltage across the sampling capacitor C_(s).During each burst cycle, V(C_(s)) increases in small steps. WhenV(C_(s)) reaches a predetermined voltage value, the acquisition phaseends. The time taken to complete the acquisition phase may be used toevaluate C_(x).

In some embodiments, the number of burst cycles is the measurement usedto evaluate the touch sensor 310. In other words, each acquisitioncorresponds to the condition of the electrode 312. When the electrode312 is in an ambient state, the number of burst cycles for eachacquisition corresponds approximately to a predetermined value. As ahuman finger or a stylus is brought proximate the electrode 312, thenumber of burst cycles during the acquisition phase changes and isdifferent from the predetermined value, which indicates a touch to theelectrode 312.

In some embodiments, repeated acquisitions are used to effectivelymeasure the capacitance C_(x). When a touch is applied to the electrode312, which acts as a touch sense electrode, the capacitance C_(t)increases and adds in parallel with capacitance C_(x) (see FIG. 1). Theincrease in C_(t) changes the effective circuit such that C_(t) andC_(x) charge in parallel, resulting in a more rapid increase in thevoltage V(C_(s)). Therefore, when a touch is applied to the electrode312 fewer burst cycles are required to charge the capacitor C_(s) inorder to achieve V(C_(s)), and therefore in response to a touch event,the number of burst cycles is reduced and the burst time shortened. Thechange in the number of burst cycles during an acquisition isproportional to C_(t).

In some embodiments a calibration stage is used to determine thepredetermined values for measurements. Once the reference value for thenumber of burst cycles is determined, this may be used as a thresholdvalue to identify a potential touch, During an acquisition, if thenumber of burst cycles drops below the threshold value, a potentialtouch is identified. A process of Detection Integration (DI) mayconsider several successive acquisitions before identifying a touchevent. The DI process detects a touch to a key or touch event for thetouch sensor configuration 200 of FIG. 2. The DI process assists inavoiding noise and other inadvertent effects which may be interpreted asa touch, but which are false reads.

FIG. 5 illustrates application of the test configuration 300 to a sensordevice 510 having multiple ports, each coupled to an electrode 512. Thetest configuration 500 is illustrated, wherein the ports of the sensordevice 510 are coupled to sampling capacitors 530, 532. As illustratedin FIG. 5, the device sensor 510 includes multiple ports, including atleast ports 518, 520, 522 and 524. The ports 518 and 522 each arecoupled to electrodes 512, each having a line resistance 514. A samplingcapacitor C_(s) 530 is positioned between the port 518 and the port 520.A sampling capacitor C_(s) 532 is positioned between port 522 and port524. As may be appreciated, the test configuration 500 adds a samplingcapacitor C_(s) each electrode 512.

The test configurations 300 and 500 require the addition of samplingcapacitors for each electrode. As the number of electrodes increases,the number of sampling capacitors also increases. In an exampleembodiment, a testing method uses relationships within a sensor device,or sensor circuitry, to measure the capacitance C_(s).

FIG. 6 illustrates a sensor device 610 having circuitry including anAnalog to Digital Converter (ADC) 616, multiple switches, S1 and S2, anda switch controller 630. The configuration 600 eliminates the use of asampling capacitor external to the sensor device 610, such as used inthe system of FIG. 3. The touch sensor configuration 600 instead uses acapacitor, C₁, coupled to the ADC 616, which is included in the sensordevice 610, thus reducing the circuitry required to implement the touchsensor configuration 600, During operation of the sensor device 610, theswitch controller 630 selectively opens and closes the switches S1 andS2. In some embodiments, the switches S1 and S2 may be controlledindividually, wherein the switch S1 couples point P1 to a referencevoltage Vdd, and the switch S2 couples the point P1 to a referenceground. The reference voltage Vdd is provided to the sensor device 610,such as through a designated pin (not shown) or by processing a receivedvoltage or electrical signal. The reference ground may be provided tothe sensor device 610 through a designated pin, or may be the voltage ofa location within the sensor device 610. For clarity of description, asingle electrode 612, having corresponding capacitance C_(x) isillustrated coupled to port 618, however, it is to be appreciated thatsensor device 610 may include any number of electrodes 612 and ports618. Port 618 is then coupled to a multiplexer (MUX) 620, wherein theconnection has a line resistance 614. The MUX 620 has multiple inputs toreceive inputs presented to ports, such as electrical signals, currentor voltage received at port 618 from the electrode 612. The MUX 620 alsohas inputs coupled directly to the reference voltage Vdd, and to thereference ground which has an associated ground voltage. A control input624 is used to select one among the multiple inputs to the MUX 620,wherein the selected one is supplied to the ADC 616. The connection 622couples the output of MUX 620 to the input of the ADC 616. The sensordevice 610 is further configured such that the switch S1 enablesconnection of the port 618 to the reference voltage Vdd, and the switchS2 enables connection of the port 618 to the reference ground.

As illustrated in FIG. 6 the switches S1 and S2 are coupled to the inputof the MUX 620, in a device having multiple input ports, each input porthas a corresponding set of switches, such as S1 and S2. An example isprovided in FIG. 8, wherein a bank of switches 811 is implemented havinga switch controller 813.

The sensor device 610 further has a capacitor, C₁, coupled to the inputto the ADC 616. The capacitor C₁ provides a filtering effect, to reduceor avoid fluctuations in voltage or signals provided from the output ofMUX 620 to the input of the ADC 616. The capacitor C1 may be used as areference capacitor to identify electrical changes at the electrode 612.The voltage Vdd/2 may be provided to device sensor 610, such as througha pin, or may be produced from the reference voltage Vdd.

An example embodiment uses the capacitance C₁, to identify changes inthe capacitance C_(x), avoiding the need to add a sampling capacitorexternal to sensor device 610. This reduces the need for externalcircuitry and provides a simplified configuration for touch sensing intouch sensor configuration 600. The switches S1 and S2 allow burstswitching to measure changes corresponding to a touch to the electrode612. Such a method is described in the table 700 of FIG. 7. Theleft-most column provides the step index, wherein steps are performedsequentially as indicated. The next column identifies the behavior orcondition of switch S1, successive columns identify the behavior ofswitch S2 and the control input, respectively. Notes are provided toexplain the test procedure.

At a first step 1, the switches S1 and S2 are open, while control 624couples the reference ground as input to the MUX 620. This grounds thecapacitance C₁ to discharge any residual voltage.

At step 2, switch S1 is closed, while switch S2 is open. The control 624couples Vdd as an input to the MUX 620. In this configuration, thecapacitor C₁ is charged to a positive value. The voltage across thecapacitor C₁ is the difference of Vdd and Vdd/2, or Vdd/2. In someembodiments, an input signal having a positive amplitude is provided tothe input to the MUX 620 at this step,

At step 3, switches S1 and S2 are open, and the input to the MUX 620 isthe input received at port 618 from the electrode 612. A firstmeasurement is made of the voltage V(C₁), which represents a positivevoltage. The measurement is made by the ADC 616.

At step 4, switch S1 remains open while switch S2 is closed. The control624 couples reference ground as an input to MUX 620. This serves tocharge the capacitor C₁ to a negative value. The voltage across thecapacitor C₁ is the difference of the ground voltage and Vdd/2, which isa negative voltage in comparison to Vdd/2. In some embodiments, an inputsignal is applied to the input to the MUX 620 which has an oppositepolarity to the input signal applied at step 2, such as to use twoopposing pulses. The opposing pulses act to reject low frequency noisesuch as mains interference from a power supply. In other words, if mainsinterference is present in the reference voltage Vdd, such interferencewill not be present in the ground reference voltage GND. Therefore, theinterference will be present in one measurement, but not in the othermeasurement. By comparing the measurements, the mains interference maybe removed. At step 5, switches S1 and S2 are open, and the input to theMUX 620 is the input received at port 618 from the electrode 612. Asecond measurement is made of the voltage V(C₁), which in this situationrepresents a negative voltage. The measurement is made by the ADC 616.

By measuring the capacitance using a positive pulse and a negativepulse, low frequency interference may be rejected mathematically.Interference may include the frequency of the processing unit (notshown), referred to as the mains hum. The low frequency interferenceexhibits as a same value in the measurements, while the measured valueof the ADC 616 reflects a positive and an inverted signal. This allowscancellation of the interference. The measurements described in table700 of FIG. 7 are based on the sharing of charge between the capacitanceC and the capacitance C₁.

FIG. 8 illustrates a processing unit 810, including a sensing circuitry820 to process signals received from electrodes (not shown) coupled toports 818. The processing unit 810 includes a controller 802 and amemory 804 coupled to the sensing circuitry 820 through communicationbus 812. A threshold memory 832 is included within the sensing circuitry820 to store threshold values and information to identify capacitancechanges. It is appreciated that various embodiments may have additionalmodules, circuitry, software, firmware and functionality, coupleddirectly or through buses or circuitry. For example, the processing unit810 may be part of an application, such as illustrated in touch sensorconfiguration 200 of FIG. 2. The sensing circuitry 820 includes an ADC822 which outputs a digital value corresponding to a received analogvalue. The ports 818 are each coupled to inputs of a MUX 824, and eachhas a line resistance 814, The sensor controller 830 may provide acontrol signal to the MUX 824 to select one of the inputs of the MUX 824to output to ADC 822, Configured between the MUX 824 and the ADC 822 isa reference circuit 826, which in some embodiments includes a referencecapacitor. The reference circuit 826 is used to identify a change inelectrical behavior or characteristics at the electrodes. When a touchis received at an electrode, the capacitance of the electrode changesdue to the proximity of the touching mechanism, such as a human finger,a stylus or other device, to the electrode.

The sensor controller 830 may further control operation of the ADC 822.In some embodiments a reference capacitor may be a variable capacitorused to adjust the sensitivity of the touch sensor.

A bank of switches 811 is coupled to the input ports 818, wherein eachof the input ports has an associated switch pair, e.g. S1 and S2, withinthe bank of switches 811. Other arrangements and configurations may beimplemented so as to provide a switching configuration as in FIG. 6 foreach port 818. In other words, each pin 818 has a switch S1 coupled toreference voltage Vdd and a switch S2 coupled to a relative ground, GND.Operations for testing each of the ports 818 is performed similarly tothe testing of port 618. The bank of switches 811 is controlled by aswitch controller 813, which controls each of the switch pairs, S1 andS2, within the bank of switches 811.

FIG. 9 illustrates a method 900 starting with an operation 902 tocalibrate the touch sensor system, such as the touch sensorconfiguration 600 of FIG. 6. The calibration phase determines thresholdvalues for a reference capacitor, such that the touch sensor system isable to distinguish between an ambient condition, where no touch isapplied to the touch sensor system, and a condition when a touch isapplied. Operation 904 serves to store the threshold values in a memorystorage device. Processing of an acquisition phase first discharges 906the reference capacitor, such as capacitor C₁ of FIG. 6. A positivevoltage is applied to the reference capacitor (operation 908) and asignal received from the electrode is measured (operation 910). Theprocess 900 continues, and a negative voltage signal is applied to thereference capacitor (operation 912), and a signal received from theelectrode is measured (operation 914).

A comparison and evaluation of the measurements is made to eliminateinterference from the signals and identify a touch event. When a touchis not detected at decisional operation 920, processing returns tooperation 906 to begin a next acquisition. In other words, the electrodeis in an ambient state and no touch is detected. When a touch isdetected at decision operation 920 processing continues to determine ifthe DI is completed (decisional operation 922). When the DI is completeand the received signals from the electrode satisfy the touch thresholdvalue, the touch detection is confirmed and processing continues toperform the action indicated by the touch (operation 924). For example,when a user applies a touch to the electrode in order to select a key orbutton on the touch sensor device, the function associated with that keyis implemented when the touch is detected. After detection of the touch,processing returns to operation 906 and a next acquisition begins. Whenthe DI is not completed at decisional operation 922, processing returnsto operation 906 to continue the current acquisition. In other words, anacquisition identifying a touch continues until the DI is complete, or ameasurement is received that does not satisfy the threshold value. TheDI is implemented to avoid spurious measurements, or measurements whichare not results of a touch at the electrode but rather are due to otheroperational conditions.

The present discussion considers a method for measuring capacitance in asensor device without additional circuitry and devices applied externalto the sensor device, such as by using an output pin of the sensordevice. The measurement methods described use an internal capacitor, orother electrical component, as a reference to identify a touch appliedto a touch point or electrode coupled to the touch sensor. The touchsensor applies charges to the reference capacitor and measures a signalreceived from an electrode. The measurements are used to identify atouch to the electrode.

The methods and apparatus described may be used in conjunction with anappliance having a human-machine interface. It is also possible toprovide a sensor, similar to those described above, which is providedseparately from the device or appliance which it controls, for exampleto provide an upgrade to a pre-existing appliance. It is also possibleto provide a generic sensor which may be configured to operate on arange of different appliances.

Although the test methods and apparatuses have been described withrespect to several embodiments, many modifications and alterations canbe made without departing from the invention. The drawings provided arenot intended to identify a particular size or scale of a module, butrather are provided for clarity of understanding as to testing andevaluation of a sensor device. Similarly, the concepts described hereinmay be applied to product enhancement involving introduction of a duallayer device, where measurement of values in a single layer devicerequired complex circuitry or prove difficult in an assembled package.

The invention claimed is:
 1. A non-transitory computer-readable mediumcomprising instructions winch, when implemented by one or more machines,cause the one or more machines to; control a first switch to charge areference capacitor to a first voltage level by applying a first voltageto a conductor of the reference capacitor, the reference capacitorcoupled to an input of an Analog to Digital Converter (ADC), the firstvoltage level being a difference between the applied first voltage and areference voltage; receive a first analog signal from a touch sensorelectrode at the input of the ADC; convert the first analog signal to afirst digital value provided at an output of the ADC; control a secondswitch to charge the reference capacitor to a second voltage level byapplying a second voltage to the conductor of the reference capacitor,the second voltage opposite in polarity to the first voltage, the secondvoltage level being a difference between the applied second voltage andthe reference voltage; receive a second analog signal from the touchsensor electrode at the input to the ADC; convert the second analogsignal to a second digital value at the output of the ADC; and detect atouch to the touch sensor device based on the first digital value. 2.The non-transitory computer-readable medium of claim 1, whereindetecting a touch comprises: calculating a difference between the firstand second digital values; and comparing the difference to a thresholdvalue.
 3. The non-transitory computer-readable medium of claim 1,wherein converting the first analog signal to the first digital value atthe output of the ADC comprises opening the first and second switches,and wherein converting the second analog signal to the second digitalvalue at the output of the ADC comprises opening the first and secondswitches.
 4. The non-transitory computer-readable medium of claim 1,wherein the reference capacitor is further coupled to the referencevoltage, the reference voltage being a function of the first voltagelevel.
 5. The non-transitory computer-readable medium of claim 1,wherein the second voltage is a ground voltage.
 6. The non-transitorycomputer-readable medium of claim 1, wherein controlling the firstswitch to charge the reference capacitor to the first voltage levelcomprises closing the first switch and opening the second switch.
 7. Thenon-transitory computer-readable medium of claim 1, wherein controllingthe second switch to charge the reference capacitor to the secondvoltage level comprises closing the second switch and opening the firstswitch.
 8. The non-transitory computer-readable medium of claim 1,wherein the instructions, when implemented by the one or more machines,further cause the one or more machines to: determine, based at leastupon the first and second digital values, an amount of mainsinterference; and remove the determined amount of mains interferencefrom the first digital value.
 9. A method, comprising: controlling afirst switch to charge a reference capacitor to a first voltage level byapplying a first voltage to a conductor of the reference capacitor, thereference capacitor coupled to an input of an Analog to DigitalConverter (ADC), the first voltage level being a difference between theapplied first voltage and a reference voltage; receiving a first analogsignal from a touch sensor electrode at the input of the ADC; convertingthe first analog signal to a first digital value provided at an outputof the ADC; controlling a second switch to charge the referencecapacitor to a second voltage level by applying a second voltage to theconductor of the reference capacitor, the second voltage opposite inpolarity to the first voltage, the second voltage level being adifference between the applied second voltage and the reference voltage;receiving a second analog signal from the touch sensor electrode at theinput to the ADC; converting the second analog signal to a seconddigital value at the output of the ADC; and detecting a touch to thetouch sensor device based on the first digital value.
 10. The method ofclaim 9, wherein detecting a touch comprises: calculating a differencebetween the first and second digital values; and comparing thedifference to a threshold value.
 11. The method of claim 9, whereinconverting the first analog signal to the first digital value at theoutput of the ADC comprises opening the first and second switches, andwherein converting the second analog signal to the second digital valueat the output of the ADC comprises opening the first and secondswitches.
 12. The method of claim 9, wherein the reference capacitor isfurther coupled to the reference voltage, the reference voltage being afunction of the first voltage level.
 13. The method of claim 9, whereinthe second voltage is a ground voltage.
 14. The method of claim 9,wherein controlling the first switch to charge the reference capacitorto the first voltage level comprises closing the first switch andopening the second switch.
 15. The method of claim 9, whereincontrolling the second switch to charge the reference capacitor to thesecond voltage level comprises closing the second switch and opening thefirst switch.
 16. The method of claim 9, further comprising:determining, based at least upon the first and second digital values, anamount of mains interference; and removing the determined amount ofmains interference from the first digital value.
 17. An apparatus,comprising: one or more processors; and one or more memory units coupledto the one or more processors, the one or more memory units collectivelystoring logic configured to, when executed by the one or moreprocessors, cause the one or more processors to perform operationscomprising: controlling a first switch to charge a reference capacitorto a first voltage level by applying a first voltage to a conductor ofthe reference capacitor, the reference capacitor coupled to an input ofan Analog to Digital Converter (ADC), the first voltage level being adifference between the applied first voltage and a reference voltage;receiving a first analog signal from a touch sensor electrode at theinput of the ADC; converting the first analog signal to a first digitalvalue provided at an output of the ADC; controlling a second switch tocharge the reference capacitor to a second voltage level by applying asecond voltage to the conductor of the reference capacitor, the secondvoltage opposite in polarity to the first voltage, the second voltagelevel being a difference between the applied second voltage and thereference voltage; receiving a second analog signal from the touchsensor electrode at the input to the ADC; converting the second analogsignal to a second digital value at the output of the ADC; and detectinga touch to the touch sensor device based on the first digital value. 18.The apparatus of claim 17, wherein detecting a touch comprises:calculating a difference between the first and second digital values;and comparing the difference to a threshold value.
 19. The apparatus ofclaim 17, further comprising a first input port to receive a first inputsignal from the touch sensor electrode.
 20. The apparatus of claim 19,further comprising a second input port to receive a second input signal,from a second touch sensor electrode.